package com.v1.video.domain;

import android.graphics.Bitmap;
import android.view.View;
import android.widget.ImageView;

import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.listener.SimpleImageLoadingListener;
import com.v1.video.Constant;
import com.v1.video.R;
import com.v1.video.util.Utils;

public class SetHead {
    
    public SetHead(){
        
    }

    /**用户头像链接，性别，头像view*/
    public void setHead(final String userImg,final String userSex, final ImageView userHeadView) {
        if (userImg == null || userImg.equals("")) {
        	userHeadView.setImageResource(R.drawable.icon_user_image_default);            
        } else {
//        	ImageLoader.getInstance().displayImage(userImg, userHeadView,
//                    Constant.IMAGE_OPTIONS_FOR_USER_COMMON);
        	ImageLoader.getInstance().displayImage(
        			userImg, userHeadView,
        			Constant.IMAGE_OPTIONS_FOR_USER_OTHER,
					new SimpleImageLoadingListener() {
						@Override
						public void onLoadingComplete(String imageUri,
								View view, Bitmap loadedImage) {
							super.onLoadingComplete(imageUri, view,
									loadedImage);
							ImageView iv = (ImageView) view;
							if (loadedImage != null) {
								iv.setImageBitmap(Utils
										.toRoundBitmap(loadedImage));
							}
						}
					});
        }
    }

}
